<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<link type="text/css" rel="stylesheet" href="css/validator.css"></link>
<script type="text/javascript" src="js/formValidator.js"></script>
<script type="text/javascript" src="js/formValidatorRegex.js"></script>
<script type="text/javascript">
$(document).ready(
	function(){
		$.formValidator.initConfig({formID:"myForm",onError:function(msg){return false;},onSuccess:function(){return true;}});
		$("#email").formValidator({onShow:"请输入邮箱",onFocus:"请输入邮箱",onCDorrect:" "}).inputValidator({min:6,max:25,onerror:"邮箱在6到25字之间,请确认"}).regexValidator({regExp:"email",dataType:"enum",onError:"你输入的邮箱格式不正确"})
	    .ajaxValidator({
		    type : "get",
			url : "register.php?action=email",
			datatype : "json",
			success : function(data){	
	            if( data == "1" ){
					return true;
				}else{
					return false;
				}
			},
			error: function(){alert("服务器没有返回数据，可能服务器忙，请重试");},
			onerror : "邮箱已被注册，请重新输入",
			onwait : "正在对邮箱进行合法性校验，请稍候..."
		});
		$("#name").formValidator({onShow:"请输入用户名",onFocus:"请输入用户名",onCDorrect:" "}).inputValidator({min:1,max:20,empty:{leftEmpty:false,rightEmpty:false,emptyError:"用户名两边不能有空符号"},onerror:"用户名在1到20字之间,请确认"})
		$("#pwd").formValidator({onShow:"请输入密码",onFocus:"请输入密码",onCDorrect:" "}).inputValidator({min:1,max:20,empty:{leftEmpty:false,rightEmpty:false,emptyError:"密码两边不能有空符号"},onerror:"密码在1到20字之间,请确认"})
		$("#pwd2").formValidator({forcevalid:true,triggerevent:"change",onshow:"请输入重复密码",onfocus:"两次密码必须一致",oncorrect:" "}).compareValidator({desID:"pwd",operateor:"=",onError:"两次密码不一致,请确认"});
		$("input:[name=sex]").formValidator({tipID:"sexTip",onShow:"请选择你的性别",onFocus:"请选择你的性别",onCorrect:"选择正确"}).inputValidator({min:1,max:1,onError:"没有选择性别,请确认"});
		$("#city").formValidator({onShow:"请选择所在城市",onFocus:"请选择所在城市",onCorrect:"选择正确"}).inputValidator({min:1,onError: "请选择所在城市"});
	}
)
</script>
</head>
<body>
<p><{$error}></p>
<form action="register.php" method="post" id="">
<table border='1'>
  <tr>
	<td>邮箱：</td>
	<td><input type="text" name="email" id="email"/></td>
	<td><div id="emailTip"></div></td>
  </tr>
  <tr>
	<td>用户名：</td>
	<td><input type="text" name="name" id="name"/></td>
	<td><div id="nameTip"></div></td>
  </tr>
  <tr>
	<td>密码：</td>
	<td><input type="password" name="pwd" id="pwd"/></td>
	<td><div id="pwdTip"></div></td>
  </tr>
  <tr>
	<td>重复密码：</td>
	<td><input type="password" name="pwd2" id="pwd2"/></td>
	<td><div id="pwd2Tip"></div></td>
  </tr>
  <tr>
	<td>性别：</td>
	<td>
		<input type="radio" id="sex1" name="sex" value="1" checked="checked"/>男
		<input type="radio" id="sex0" name="sex" value="0"/>女
	</td>
	<td><div id="sexTip"></div></td>
  </tr>
  <tr>
	<td>所在地：</td>
	<td>
		<select name="province" onchange="getArea('city',$(this),$('#city'),$('#county'))">
			<option value="">省/直辖市</option>
			<{foreach item=province from=$province}>
			<option value="<{$province.provinceid}>"><{$province.province}></option>
			<{/foreach}>
		</select>
		<select name="city" id="city" style="display:none;" onchange="getArea('county',$(this),$('#county'),$('#county'))"></select>
		<select name="county" id="county" style="display:none;"></select>
	</td>
	<td><div id="cityTip"></div></td>
  </tr>
  <tr>
	<td>验证码：</td>
	<td>
		<img style="cursor:pointer" src="include/codeimg.php" id="imgcode" onclick="document.getElementById('imgcode').src='include/codeimg.php?t='+Math.random()"  title="点击刷新"/>
		<input type="text" name="imgcode" id="imgcode"/>
	</td>
	<td><div id="imgcodeTip"></div></td>
  </tr>
  <tr>
  	<td colspan="3" align="center"><input type="submit" name="submit" value="提交"/></td>
  </tr>
</table>
</form>
</body>
</html>